home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1018 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: t500.vol.it!news
  2. From: robiz@mbox.vol.it (Roberto Bizzarri)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Help with an easy C issue.
  5. Date: 13 Jan 1996 22:14:07 GMT
  6. Organization: Video On Line
  7. Message-ID: <752.6586T1383T2827@mbox.vol.it>
  8. References: <737.6585T1284T2078@in.net>
  9. NNTP-Posting-Host: 194.166.59.133
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  11.  
  12. On 13-Jan-96 03:30:59, John J. Maver, Jr. (mave@in.net) write to All:
  13. >    This is going to be rediculously easy to solve.  thanks  in advance!!
  14.  
  15. >    I have a value entered as a string like,
  16.  
  17. >    char *mystring;
  18.  
  19. This is wrong! You must declare a buffer:
  20.      char mystring[100];  /* 100 bytes */
  21.  
  22.  
  23. >    printf("Enter your age>");
  24. >    scanf("%s",&mystring);
  25.  
  26. >    Now I want it to be an int, so:
  27. >    myint=atoi(mystring);
  28. >    I mess around with the int:
  29. >    myint=myint+10;
  30. >    And I want to turn myint back into a string.
  31. >    HOW???
  32.  
  33.      sprintf(mystring, "%d", myint);
  34.  NB: ^
  35.  
  36. ...then look to "mystring"!  ;-)
  37.  
  38.  
  39.  
  40.  
  41.  
  42. __        __
  43.  |_)       |_)
  44.  | \oberto |_)izzarri  (E-mail: robiz@mbox.vol.it)
  45.                        (FidoNet: 2:332/901.31)
  46.  
  47.